.advanced-hooks {
  padding: 20px;
  max-width: 1200px;
  margin: 0 auto;
}

.example-container {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 20px;
  margin: 20px 0;
}

.example-container h4 {
  margin: 0 0 15px 0;
  color: #495057;
  border-bottom: 2px solid #007bff;
  padding-bottom: 8px;
}

/* 自定义 Hook 样式 */
.custom-hooks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.hook-example {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
}

.hook-example h5 {
  margin: 0 0 10px 0;
  color: #495057;
  font-size: 16px;
}

.counter-display {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 10px;
  background-color: #e9ecef;
  border-radius: 4px;
}

.counter-controls {
  display: flex;
  gap: 10px;
}

.counter-controls button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

.counter-controls button:hover {
  background-color: #0056b3;
}

.local-storage-example input,
.debounce-example input,
.title-example input {
  width: 100%;
  padding: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.local-storage-example p,
.debounce-example p,
.title-example p {
  margin: 5px 0;
  font-size: 14px;
  color: #6c757d;
}

/* useReducer 样式 */
.reducer-example {
  text-align: center;
}

/* Context 样式 */
.light-theme {
  background-color: #f8f9fa;
  color: #212529;
}

.dark-theme {
  background-color: #343a40;
  color: #f8f9fa;
}

.context-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.context-controls button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
}

.context-controls button:hover {
  background-color: #0056b3;
}

.context-consumer {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 10px;
}

.theme-value {
  font-weight: bold;
  color: #007bff;
}

.user-value {
  font-weight: bold;
  color: #28a745;
}

/* useLayoutEffect 样式 */
.layout-effect-example {
  text-align: center;
}

.moving-box {
  width: 100px;
  height: 100px;
  background-color: #007bff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 20px auto;
  border-radius: 8px;
  transition: transform 0.3s ease;
}

/* useImperativeHandle 样式 */
.imperative-handle-example {
  text-align: center;
}

.editable-input {
  margin-bottom: 20px;
}

.editable-input-field {
  padding: 8px;
  border: 1px solid #ced4da;
  border-radius: 4px;
  font-size: 16px;
  width: 200px;
}

.editable-input-display {
  display: inline-block;
  padding: 8px 12px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  min-width: 200px;
}

.editable-input-display:hover {
  background-color: #e9ecef;
}

/* useMemo 样式 */
.memo-example {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.calculation-section,
.todo-section {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
}

.calculation-section h5,
.todo-section h5 {
  margin: 0 0 10px 0;
  color: #495057;
}

.calculation-section p {
  margin: 10px 0;
}

.todo-section ul {
  margin: 10px 0;
  padding-left: 20px;
}

.todo-section li {
  margin-bottom: 5px;
}

/* useCallback 样式 */
.callback-example {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.counter-section {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
}

.counter-section h5 {
  margin: 0 0 10px 0;
  color: #495057;
}

.todo-sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.todo-section {
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
}

.todo-section h5 {
  margin: 0 0 10px 0;
  color: #495057;
}

/* 可见性检测样式 */
.visibility-component {
  text-align: center;
}

.visibility-box {
  width: 200px;
  height: 100px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.visibility-box.visible {
  background-color: #28a745;
  color: white;
}

.visibility-box.hidden {
  background-color: #dc3545;
  color: white;
}

/* 通用控件样式 */
.controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 15px 0;
  flex-wrap: wrap;
}

.controls button {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.controls button:hover {
  background-color: #0056b3;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .custom-hooks-grid {
    grid-template-columns: 1fr;
  }
  
  .memo-example {
    grid-template-columns: 1fr;
  }
  
  .todo-sections {
    grid-template-columns: 1fr;
  }
  
  .counter-display {
    flex-direction: column;
    gap: 5px;
  }
  
  .controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .context-controls {
    flex-direction: column;
  }
}